Fix spurious rebuilds when switching source paths
authorAlex Crichton <alex@alexcrichton.com>
Mon, 8 Jun 2015 22:18:38 +0000 (15:18 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Mon, 8 Jun 2015 22:18:38 +0000 (15:18 -0700)
commitddf3c7955a51d251779fee9e971d3d30ed55ebaf
treea76114e119f0a1d93c206cc9a9a23300714b4fc9
parent348c7389957364903852d6826a4d5b93ed2c8454
Fix spurious rebuilds when switching source paths

The method of creating package ids in Cargo means that all sub-crates of a main
repo have the same package id, which encodes the path it came from. This means
that if the "root crate" switches, the package id for all dependencies will
change, causing an alteration in package id hashes, causing recompiles.

This commit alters a few points of hashing to ensure that whenever a package is
being hashed for freshness the *source root* of the crate is used instead of the
root of the main crate. This cause the hashes to be consistent across compiles,
regardless of the root package.

Closes #1694
src/cargo/core/package.rs
src/cargo/core/package_id.rs
src/cargo/ops/cargo_rustc/context.rs
src/cargo/ops/cargo_rustc/layout.rs
src/cargo/util/toml.rs
tests/test_cargo_compile_path_deps.rs